<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.util.Date"%>
<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@page import="org.apache.commons.net.ftp.FTPFile"%>
<%@page import="kickboxing.controller.FTPManager"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="kickboxing.model.Uzytkownik"%>    
<style type="text/css">
#kth {
margin-left: 10px;
margin-right: 10px;
font-family: Verdana;
	}


#tytul{
 text-align: justify;
 font-family:Verdana;
 font-size:22px;
 color: white;
 margin-left: 50px;
 margin-right: 50px;
 text-align: left;
}

</style>
<a href="index.jsp">powrot</a>



<% FTPManager ftp = new FTPManager();
	ftp.polaczZFTP();
	FTPFile [] galerie = ftp.pokazKatalogiNaSerwerze();
	String [] miechy = {"Styczen", "Luty", "Marzec", "Kwiecien", "Maj", "Czerwiec", "Lipiec", "Sierpien", "Wrzesien", "Pazdziernik", "Listopad", "Grudzien"};
	
%>
	
	<div id="kth">

<p id=tytul>Lista Galerii</p>
<table>
	
	
		<%	for(FTPFile galeria: galerie){ 
				if(galeria.getName().equals(".") || galeria.getName().equals("..") || galeria.getName().equals("zdjeciaProfilowe")){
					//nic nie rob
				}else{
					out.println("<tr>");
					out.print("<td><a class=\"next_page\" href='index.jsp?web=wyswietlGalerieZdjec&nazwa="+ galeria.getName() +"'>"+ galeria.getName() + "</a></td>");
					out.print("<td>"+ galeria.getTimestamp().get(Calendar.DAY_OF_MONTH) + " " + miechy[galeria.getTimestamp().get(Calendar.MONTH)] + " " + galeria.getTimestamp().get(Calendar.YEAR) + "</td>");
					
					
						Uzytkownik user = (Uzytkownik)session.getAttribute("user");
						if(user != null){
							if(user.getPrawa() == 'a')
							{
								out.print("<td><a href='usunGalerieZdjec.jsp?name=" + galeria.getName() + "'>Usun</a></td>");
							}}
					
					
					
					out.println("</tr>");
				}
				
				
			} %>
		
	
</table>
</div>
	<%
		ftp.rozlaczZFTP();
	%>
